<template>
    <div class="login-container">
        <div class="login-box">
            <h2>登录</h2>
            <form @submit.prevent="handleLogin">
                <div class="input-group">
                    <label for="username">用户名</label>
                    <input type="text" id="username" v-model="username" required />
                </div>
                <div class="input-group">
                    <label for="password">密码</label>
                    <input type="password" id="password" v-model="password" required />
                </div>
                <button type="submit" class="login-button">登录</button>
            </form>
        </div>
    </div>
</template>

<script>
export default {
    name: 'LoginPage',
    data() {
        return {
            username: '',
            password: ''
        };
    },
    methods: {
        handleLogin() {
            // Handle login logic here
            console.log('Logging in with', this.username, this.password);
        }
    }
};
</script>

<style scoped>
/* 背景颜色自动变化的动画效果 */
@keyframes gradientAnimation {
  0% {
    background-position: 0% 50%;
  }
  25% {
    background-position: 50% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  75% {
    background-position: 50% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 98vh;
    background: linear-gradient(135deg, #6e8efb, #a777e3, #fbc2eb, #a6c1ee);
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 300px;
}

h2 {
    margin-bottom: 1.5rem;
    color: #333;
}

.input-group {
    margin-bottom: 1rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
}

input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.login-button {
    width: 100%;
    padding: 0.75rem;
    background: #6e8efb;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.login-button:hover {
    background: #5a7de1;
}
</style>